'use strict'

/**
 * @ngdoc function
 * @name consoleAngularUiApp.filter:serviceTypesFilter
 * @description
 * # ServiceTypesFilter
 * Filter of the consoleAngularUiApp to output feild value by service type id
 */

 angular.module('consoleAngularUiApp')
 	.filter('serviceTypesFilter', ['serviceTypesVal', function(serviceTypesVal){

	 		return function(input, feild){
	 			var servicetypes = serviceTypesVal.$get();
 				var sType = null;
 				for(var i = 0; i < servicetypes.length; i++){
 					if (input == servicetypes[i].serviceTypeId) {
 						sType = servicetypes[i];
 					}
 				}

 				if (sType != null) {
 					return sType[feild];
 				} else {
 					return null;
 				}
	 		}
 	}]);